package pres.wchen.bussiness.cor.performance;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import pres.wchen.bussiness.cor.http.HttpClientManager;
import pres.wchen.bussiness.service.BusProjectVersionService;
import pres.wchen.bussiness.vo.BusProjectVersionVO;

import java.util.Map;

/**
 * @作者： wchen
 * @描述： 异步任务执行
 * @创建时间： 2018/2/20 23:57
 * @版本：Copyright 2018, Inc. All Rights Reserved.
 * @修改信息：
 */
@Component
public class AsyncManager {

    @Autowired
    private BusProjectVersionService busProjectVersionService;


    @Async
    public void doService(String requestUrl, Map paramMap) {
        JSONObject jsonObject = HttpClientManager.doGet(requestUrl, paramMap);
        if(jsonObject == null){
            BusProjectVersionVO busProjectVersionVO = new BusProjectVersionVO();
            busProjectVersionVO.setStatus("3");
            busProjectVersionVO.setId(new Long(paramMap.get("id").toString()));
            busProjectVersionVO.setRemark("请求接口失败！");
            busProjectVersionService.update(busProjectVersionVO);
        }
    }



}
